In image processing, a depth map of an image is presented as a grayscale image containing information related to a depth value of each pixel of the image, the depth value representing a distance between the camera and a part of an object shown in the image represented by the corresponding pixel. Conventionally, obtaining the depth map of the image involves weighted calculation of the depth value of each pixel of the image, which may be time-consuming. Moreover, when a video that includes a plurality of image frames is to be processed, in order to maintain efficiency, a processor with better calculating performance must be employed (resulting in higher hardware costs), or the number of the image frames of the video that are to be processed may need to be reduced (adversely affecting the quality of subsequently generated 3D images).
In addition, for refocusing an image captured by a light-field camera with the focus being on a certain part of the image, the depth map of the image will be used to obtain the depth values of the pixels composing that part of the image, and remaining parts of the image that are not to be focused will be blurred in various degrees.